// ECMAScript 2017

// const obj = {
//     foo: 'value1',
//     bar: 'value2'
// }

// Object.values --------------------------------------------
// console.log(Object.values(obj))


// Object.entries -------------------------------------------
// for(const [key, value] of Object.entries(obj)){
//     console.log(key, value)
// }

// console.log(new Map(Object.entries(obj)))



// Object.getOwnPropertyDescriptors -------------------------

const p1 = {
    firstName: 'Lei',
    LastName: 'Wang',
    get FullName() {
        return this.firstName + ' ' + this.LastName
    }
}

// console.log(p1.FullName) //Lei Wang
// const p2 = Object.assign({}, p1)
// p2.firstName = 'zce'
// console.log(p2.FullName) //Lei Wang

// const descriptors = Object.getOwnPropertyDescriptors(p1)
// const p2 = Object.defineProperties({}, descriptors)
// p2.firstName = 'ace'
// console.log(p2.FullName)



// String.prototype.padStart / String.prototype.padEnd ------
const books = {
    html: 5,
    css: 16,
    javascript: 128
}
for(const [name, count] of Object.entries(books)) {
    console.log(`${name.padEnd(16, '-')} | ${count.toString().padStart(3, '0')}`)
}


// 在函数参数中添加尾逗号 -------------------------------------
function foo (bar, foo,) {

}